package org.simplecrm.controllers.events.propertyeditors;

import org.simplecrm.domain.user.User;

import java.beans.PropertyEditorSupport;

/**
 * Created by oler on 16.09.14.
 */
public class SupportPropertyEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {

        if (text.trim().equals("")) {
            setValue(null);
            return;
        }

        User support = new User();
        support.setId(Integer.parseInt(text));

        setValue(support);
    }
}
